#include <iostream>

#include "PvImageType.h"

#include <tdds/xtypes/DynamicType.hpp>
#include <tdds/xtypes/DynamicTypeMember.hpp>

#include "dds/type/dynamic/detail/DynamicType.h"
#include "dds/type/dynamic/detail/DynamicTypeMember.h"

using dds::type::dynamic::DynamicTypeMembersByName;
using dds::type::dynamic::DynamicTypeMember;
using dds::type::dynamic::MemberDescriptor;

using epics::rec::oxtypes::PvImageType;

int main() {

  PvImageType pvImageType;

  std::cout << pvImageType.name() << std::endl;

  // members

  DynamicTypeMembersByName members = pvImageType.all_members_by_name();

  DynamicTypeMembersByName::const_iterator it;

  for(it = members.begin(); it != members.end(); it++){

    const DynamicTypeMember& dtm = it->second;
    const MemberDescriptor& md = dtm.descriptor();

    std::cout << md.name() << ", " 
	      << md.id() << ", "
	      << md.index() << ", " 
	      << md.type().name() 
	      << std::endl;
  }
   
  return 0;
}
